﻿using System;
using MyFloridaHouse.LibDTO;
using System.Data;
using Microsoft.SqlServer.Types;

namespace MyFloridaHouse.DataAccess.Extensions
{
    public static class RegionShapeDTODataContract
    {
		/// <summary>
		/// RegionShape Data contract.
		/// </summary>
		/// <param name="rdr">The RDR.</param>
		/// <returns><see cref="RegionShapeDTO"/></returns>
        public static RegionShapeDTO DataContract(IDataReader rdr)
        {
            var newItem = new RegionShapeDTO
                          	{
                          		regionID = (int) rdr["regionID"],
                          		centerLngX = Convert.ToDouble(rdr["centerLngX"]),
                          		centerLatY = Convert.ToDouble(rdr["centerLatY"]),
                          		mapGeom = (SqlGeometry) rdr["mapGeom"]
                          	};
        						//Todo: Fix the map to geom
								//mapGeog = (SqlGeography)rdr["mapGeog"];
			return (newItem);
        }
    }
}
